<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.cg.slms.domain.*,java.util.*"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	if (request.getAttribute("stockorder") == null) {
		Stockorder stockorder = new Stockorder();
		stockorder.setMerchandise(new Merchandise());
		stockorder.setClient(new Client());
		stockorder.setEmployee(new Employee());
		request.setAttribute("stockorder", stockorder);
	}
%>
<html>
<head>
<base href="<%=basePath%>" />
<title>订单</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<script language="javascript" src="script/main.js"></script>
<script language="javascript" src="script/calendar5.js"></script>
<script type="text/javascript">
    var c = new Calendar("c");                     
    document.write(c);
</script>  
<script language="javascript">
	function deleteRecord(url) {
		if (window.confirm("确定要删除选中的记录吗？")) {
			window.location=url;
		}
	}
</script>
</head>
<body>
<form:form action="stockorderAction" method="post" modelAttribute="stockorder" style="position:relative;top:50px">
	<table border="0" cellpadding="1" cellspacing="1" width="95%">
		<tr>
			<td align="right" width="10%" nowrap="nowrap">订货单编号</td>
			<td width="20%">
				<form:input path="code" class="form-control"></form:input>
			</td>
			<td align="right" width="10%" nowrap="nowrap">货物名称</td>
			<td width="20%">
				<form:select path="merchandise.id" items="${merchandises}" />
			</td>
			<td align="right" width="10%">供应商</td>
			<td width="20%">
				<form:select path="client.id" items="${clients}"/>
			</td>
			<td width="10%">&nbsp;</td>
		</tr>
		<tr>
			<td align="right" width="10%" nowrap="nowrap">进货日期</td>
			<td width="20%">
				<form:input path="orderdate" class="form-control" onclick="c.show(this);"/>
			</td>
			<td align="right" nowrap="nowrap">经手人</td>
			<td>
				<form:select path="employee.id" items="${employees}"/>
			</td>
			<td align="right">&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
	</table>

	<p></p>
	<div style="margin-left: 30px; margin-right: 0px">
	<table border="0" cellpadding="0" cellspacing="0" width="95%" style="position:relative;left:450px;margin-bottom:20px">
		<tr>
			<td width="10%">
				<input type="submit" value="查找" class="btn btn-info" />
			</td>
			<td width="10%">
				<a href="preAddStockorderAction" class="btn btn-info">新增</a>
			</td>
			<td width="80%">&nbsp;</td>
		</tr>
	</table>
	</div>
	<div style="margin-left: 30px; margin-right: 0px">
	<table width="90%" border="0" cellpadding="0" cellspacing="0" class="table table-striped">
		<tr>
			<td width="6%" class="td_title">删除</td>
			<td width="6%" class="td_title">修改</td>
			<td width="6%" class="td_title">序号</td>
			<td width="10%" class="td_title">订单编号</td>
			<td width="19%" class="td_title">客户名称</td>
			<td width="9%" class="td_title">货物名称</td>
			<td width="13%" class="td_title">订单数量</td>
			<td width="12%" class="td_title">订货日期</td>
			<td width="10%" class="td_title">经手人</td>
		</tr>
		<c:if test="${!empty requestScope.stockorders}">
			<c:forEach items="${requestScope.stockorders}" var="sto">
				<tr>
					<td class="td_border" align="center">
						<a href="javascript:deleteRecord('deleteStockorderByIdAction?id=${sto.id}')">
							<img src="image/wrong.gif" border="0"/>
						</a>
					</td>
					<td class="td_border" align="center">
						<a href="findStockorderByIdAction?id=${sto.id}">
							<img src="image/edit.gif" border="0"/>
						</a>
					</td>
					<td class="td_border">${sto.id}</td>
					<td class="td_border">${sto.code}</td>
					<td class="td_border">${sto.client.name}</td>
					<td class="td_border">${sto.merchandise.name}</td>
					<td class="td_border">${sto.merchandisenumber}</td>
					<td class="td_border">${sto.orderdate}</td>
					<td class="td_border">${sto.employee.name}</td>
				</tr>
			</c:forEach>
		</c:if>

	</table>
	</div>
</form:form>
</body>
</html>